//
//  HeadView.swift
//  DiDiRecycle
//
//  Created by abb on 16/8/8.
//  Copyright © 2016年 abb. All rights reserved.
//

import UIKit

class HeadView: UIView {

    init(title:String,color:UIColor) {
        super.init(frame: CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: 10))
        label.text = title
        label.textColor = color
        splitLineRight.backgroundColor = color
        splitLineLeft.backgroundColor = color
        setupUI()
    }
    
    private func setupUI() {
        addSubview(splitLineLeft)
        addSubview(splitLineRight)
        addSubview(label)
        label.snp_makeConstraints { (make) in
            make.center.equalTo(self)
        }
        splitLineLeft.snp_makeConstraints { (make) in
            make.right.equalTo(label.snp_left).offset(-5)
            make.centerY.equalTo(self)
            make.height.equalTo(0.5)
            make.left.equalTo(self).offset(20)
        }
        splitLineRight.snp_makeConstraints { (make) in
            make.left.equalTo(label.snp_right).offset(5)
            make.centerY.equalTo(self)
            make.height.equalTo(0.5)
            make.right.equalTo(self).offset(-20)
        }

    }
    
    /// or分割线左
    private lazy var splitLineLeft:UIView = UIView()
    /// or分割线右
    private lazy var splitLineRight:UIView = UIView()
    /// ORLabel
    private lazy var label:UILabel = {
        let label = UILabel.creatLabel(color: UIColor.tintColor(), fontSize: 14)
        label.textAlignment = NSTextAlignment.Center
        label.text = "OR"
        return label
    }()
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
